<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>回款计划</title>
	<script src="/js/vue.js"></script>
	<script src="/js/axios.js"></script>
	<script src="/js/qs.js"></script>
	<script src="//unpkg.com/element-ui@2.4.11/lib/index.js"></script>
	<style scoped>
		/* 在此定义当前页面css */
		@import url("//unpkg.com/element-ui@2.4.11/lib/theme-chalk/index.css");
	</style>
</head>
<body> 
			<!-- 搜索 -->
			<br />
			<div id="bigbox">
				<div style="width: 100%;margin-left: 15px;display: block;" id="app1">
					<i class="el-icon-caret-right" style="line-height: 40px;margin-right: 5px; float: left;"></i>
					<template style="margin-top: 50px;">
						<el-select v-model="value7"  @change="findchange()" filterable placeholder="全部数据" style="float: left;width: 120px; height: 60px;">
							<el-option v-for="item in allcomoptions" :key="item.value" :label="item.label" :value="item.value">
							</el-option>
						</el-select>
					</template>
					<i class="el-icon-search" style="line-height: 40px;float: left;margin-left: 10px; width: 50px; height: 50px;"></i>
					<!-- 搜索框 -->
					<div style="display: block;margin-left: -20px;float: left;margin-top: -4px;">
						<el-input style="width: 200px;" placeholder="" v-model="inputtheme">
							<el-button slot="append" @click="search()" style=" width: 80px;">
								订单
							</el-button>
						</el-input>
					</div>
				</div>
				<!-- 表单 -->
				<div style="width: 100%;float: left;"  id="app2">
					<div style="float: left;margin-left: 30px;margin-top: -10px;">
						<p style="font-size: 13px;color: #333333;">回款计划<a style="font-size: 12px;color: #807E7E;">&nbsp;共${page.total}条</a></p>
					</div>
					<div style="float: right;display:  block;margin-right: 20px;margin-top: -10px;">
						<!-- 新建投诉 -->
						<!-- '<el-button size="small" icon="el-icon-circle-plus" @click="addbmppage()" style="width: 80px;"> 新建</el-button>' -->
						<!-- Form -->
						<el-dialog title="回款计划" :visible.sync="dialogFormVisible" width="50%" >
							<hr style="border: 0.5px solid #666666;margin: -15px 0px 35px;" />
							<el-form :model="bmpform" :rules="rules" ref="bmpform" label-width="100px" class="demo-bmpform" style="margin-top: 20px;">
								<el-form-item label="对应客户:"  required prop="comcustid"  :label-width="formLabelWidth">
									<el-select v-model="bmpform.comcustid" @clear="comcustidto()" @change="selectOne()" clearable filterable="" style="width: 60%;" remote="" reserve-keyword placeholder="请输入关键词" :remote-method="cumremoteMethod" :loading="cumloading">
										<i slot="prefix" class="el-input__icon el-icon-search"></i>
										<el-option v-for="item in customer" :key="item.value" :label="item.label" :value="item.value"> 
									</el-option>
									</el-select>
								</el-form-item>
								<el-form-item label="订单"  required prop="orderid" :label-width="formLabelWidth">
									<!-- <el-autocomplete v-model="bmpform.orderid" :fetch-suggestions="querySearchAsync" placeholder="请输入内容" @select="handleSelect"
									 style="width: 60%;"></el-autocomplete> -->
									 <el-select v-model="bmpform.orderid" clearable filterable=""    style="width: 60%;" remote="" reserve-keyword placeholder="请输入关键词" :remote-method="orremoteMethod" :loading="orloading">
									 	<i slot="prefix" class="el-input__icon el-icon-search"></i>
									 	<el-option v-for="item in orderes" :key="item.value" :label="item.label" :value="item.value"> 
									 </el-option>
									 </el-select>
								</el-form-item>
								<el-row :gutter="20">
									<el-col :span="12">
										<el-form-item label="计划回款日期:" required prop="date1" :label-width="formLabelWidth">
											<el-date-picker v-model="bmpform.date1"  type="date"  value-format="yyyy-MM-dd" placeholder="选择日期">
											</el-date-picker>
										</el-form-item>
									</el-col>
									<el-col :span="12">
										<el-form-item label="金额:" required prop="bmpmoney" :label-width="formLabelWidth">
											<el-input v-model="bmpform.bmpmoney" style="width: 50%;"></el-input>
										</el-form-item>
									</el-col>
								</el-row>
								<el-row :gutter="20">
											<template>
												<el-radio v-model="bmpform.radiosatus" label="已回">已回</el-radio>
												<el-radio v-model="bmpform.radiosatus" label="未回">未回</el-radio>
												<el-radio v-model="bmpform.radiosatus" label="不提醒">不提醒</el-radio>
											</template>
										</el-form-item>
								</el-row>
								<el-row :gutter="20">
									<el-col :span="12">
										<!-- prop="uitemv" -->
										<el-form-item label="所有者:"  required prop="uid"  :label-width="formLabelWidth" required>
											<el-select v-model="bmpform.uid"  @clear="uitemvto()"  clearable filterable="" remote="" reserve-keyword placeholder="请输入关键词" :remote-method="uidremoteMethod" :loading="uidloading">
												<i slot="prefix" class="el-input__icon el-icon-search"></i>
												<el-option v-for="item in uitemv" :key="item.value" :label="item.label" :value="item.value"> 
											</el-option>
											</el-select>
										</el-form-item>
									</el-col>
									<el-col :span="12">
									</el-col>
								</el-row>
								<el-form-item label="备注:" :label-width="formLabelWidth">
									<el-input type="textarea" :rows="12" :autosize="{ minRows: 1 }" placeholder=""  v-model="bmpform.textcommunication" style="width: 80%;"></el-input>
								</el-form-item>
							</el-form>
							<div slot="footer" class="dialog-footer">
								<el-button @click="dialogFormVisible = false">取 消</el-button>
								<!-- dialogFormVisible = false -->
								<el-button type="primary" @click="submitForm('bmpform')">添加</el-button>
							</div>
						</el-dialog>
	
					</div>
				</div>
	
				<!-- 表单 -->
				<div id="app3" style="margin-left: 10px;">
					<template>
						<el-table ref="multipleTable" tooltip-effect="dark"  @selection-change="handleSelectionChange" :data="bmptable" border style="width: 100%;color: black;">
							<el-table-column type="selection" width="35" align="center" >
							</el-table-column>
							<el-table-column prop="ID" label="ID" width="60" align="center">
							</el-table-column>
							<el-table-column prop="bmpmoney" label="金额" align="center">
							</el-table-column>
							<el-table-column prop="bmpbmpdate" label="计划回款日期" align="center">
							</el-table-column>
							<el-table-column prop="orderName" label="订单" align="center">
							</el-table-column>
							<el-table-column prop="custName" label="客户" align="center">
							</el-table-column>
							<el-table-column prop="isBackMoney" label="是否回款" align="center">
							</el-table-column>
							<el-table-column prop="uid" label="所有者" align="center">
							</el-table-column>
							<el-table-column fixed="right" label="操作" width="100" align="center">
								<template slot-scope="scope">
									<el-tooltip content="Bottom center" placement="bottom">
										<div slot="content">删除</div>
										<i class="el-icon-delete" style="margin: 0px 10px;font-size: 17px;" @click="deletenew(scope.row.ID)"></i>
									</el-tooltip>
									<el-tooltip content="Bottom center" placement="bottom">
										<div slot="content">编辑</div>
										<i class="el-icon-edit" @click="updatehandleClick(scope.row.ID)" style="font-size: 17px;"></i>
									</el-tooltip>
									<el-dialog title="提示" :visible.sync="dialogDelete" width="30%" append-to-body >
						 	 			<span>你确定要删除吗？</span>
							  				<span slot="footer" class="dialog-footer">
							   				<el-button @click="dialogDelete = false">取 消</el-button>
							   				<el-button type="primary" @click="dialogDelete = false" v-on:click="Delete" >确 定</el-button>
						 				</span>
									</el-dialog>
										
								</template>
							</el-table-column>
						</el-table>
						<el-dialog title="回款计划" :visible.sync="dialogFormVisible" width="50%" >
							
								<hr style="border: 0.5px solid #666666;margin: -15px 0px 35px;" />
								<el-form :model="bmpform" :rules="rules" ref="bmpform" label-width="100px" class="demo-bmpform" style="margin-top: 20px;">
									<el-form-item label="对应客户:" @clear="comcustidto()" required prop="comcustid"  :label-width="formLabelWidth">
										<el-select v-model="bmpform.comcustid" @change="selectOne()" clearable filterable="" style="width: 60%;" remote="" reserve-keyword placeholder="请输入关键词" :remote-method="cumremoteMethod" :loading="cumloading">
											<i slot="prefix" class="el-input__icon el-icon-search"></i>
											<el-option v-for="item in customer" :key="item.value" :label="item.label" :value="item.value"> 
										</el-option>
										</el-select>
									</el-form-item>
									<el-form-item label="订单"  required prop="orderid" :label-width="formLabelWidth">
										<!-- <el-autocomplete v-model="bmpform.orderid" :fetch-suggestions="querySearchAsync" placeholder="请输入内容" @select="handleSelect"
										 style="width: 60%;"></el-autocomplete> -->
										 <el-select v-model="bmpform.orderid" clearable filterable=""    style="width: 60%;" remote="" reserve-keyword placeholder="请输入关键词" :remote-method="orremoteMethod" :loading="orloading">
										 	<i slot="prefix" class="el-input__icon el-icon-search"></i>
										 	<el-option v-for="item in orderes" :key="item.value" :label="item.label" :value="item.value"> 
										 </el-option>
										 </el-select>
									</el-form-item>
									<el-row :gutter="20">
										<el-col :span="12">
											<el-form-item label="计划回款日期:" required prop="bmpbmpdate" :label-width="formLabelWidth">
												<el-date-picker v-model="bmpform.bmpbmpdate"  type="date"  value-format="yyyy-MM-dd" placeholder="选择日期">
												</el-date-picker>
											</el-form-item>
										</el-col>
										<el-col :span="12">
											<el-form-item label="金额:" required prop="bmpmoney" :label-width="formLabelWidth">
												<el-input v-model="bmpform.bmpmoney" style="width: 50%;"></el-input>
											</el-form-item>
										</el-col>
									</el-row>
									<el-row :gutter="20">
											<el-form-item label="状态:" prop="isBackMoney" :label-width="formLabelWidth" required>
												<template>
													<el-radio v-model="bmpform.isBackMoney" label="已回">已回</el-radio>
													<el-radio v-model="bmpform.isBackMoney" label="未回">未回</el-radio>
													<el-radio v-model="bmpform.isBackMoney" label="不提醒">不提醒</el-radio>
												</template>
											</el-form-item>
									</el-row>
									<el-row :gutter="20">
										<el-col :span="12">
											<!-- prop="uitemv" -->
											<el-form-item label="所有者:"  required prop="uid"  :label-width="formLabelWidth" required>
												<el-select v-model="bmpform.uid"  @clear="uitemvto()" clearable filterable="" remote="" reserve-keyword placeholder="请输入关键词" :remote-method="uidremoteMethod" :loading="uidloading">
													<i slot="prefix" class="el-input__icon el-icon-search"></i>
													<el-option v-for="item in uitemv" :key="item.value" :label="item.label" :value="item.value"> 
												</el-option>
												</el-select>
											</el-form-item>
										</el-col>
										<el-col :span="12">
										</el-col>
									</el-row>
									<el-form-item label="备注:" :label-width="formLabelWidth">
										<el-input type="textarea" :rows="12" :autosize="{ minRows: 3 }" placeholder=""  v-model="bmpform.textcommunication" style="width: 80%;"></el-input>
									</el-form-item>
								</el-form>
								<div slot="footer" class="dialog-footer">
									<el-button @click="dialogFormVisible = false">取 消</el-button>
									<!-- dialogFormVisible = false -->
									<el-button type="primary" @click="submitForm('bmpform')">修改</el-button>
								</div>
						</el-dialog>
							
						<div style="margin-top: 10px">
							<!-- 分页 -->
							<div style="display: block; float: left; margin-left: 160px;">
								<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage4"
								 :page-sizes="[4, 6, 8,10]" :page-size="pages.pageSize" layout="total, sizes,prev, pager, next, jumper" :total="pages.total">
								</el-pagination>
							</div>
						</div>
					</template>
				</div>
	
	
			</div>
			<script type="text/jscript">
					var backMoneytable = ${list};
					var pageinfo = ${pagejson};
				var Main = {
					data() {
						return {
							allcomoptions: [{
								value: '0',
								label: '全部数据'
							}, {
								value: '已回',
								label: '已回'
							}, {
								value: '未回',
								label: '未回'
							}],
							allcominfor: '',
							complaintheme: '',
							value7:'',
							inputtheme:''
						}
				
					},
					methods:{
							findchange(){
							var pageSize= Max.pasSize;
							var statusid=null;
							var search=null;
							var app = app3;
							if(this.value7.toString()== "0"){
								window.location.hash='#/sales/prosale/backMoneyPlan';
							}else{
								window.location.hash='#/sales/prosale/backMoneyPlan?statusid='+this.value7;
								statusid=this.value7;
							}
							
							$.ajax({
							      type: "post",
							      url: "/sales/prosale/backMoneyPlan",
							      data: {pageNum:1,pageSize:pageSize,statusid:statusid,search:search},
							      success: function (sdata) {
							    	  console.log("页数打印*****："+sdata);
							    	 app.bmptable=sdata.list;
							    	 app.pages = sdata;
							    	 app.currentPage4 = sdata.pageNum;
							      }
							});
						},
						
						search(){
							var pageSize= Max.pasSize;
							var statusid=null;
							var search=null;
							var _this = app3;
							//判断是否带条件;
							//判断是否根据条件筛选
							if(this.value7.toString()=='0'||this.value7.toString()==''){
								if(this.inputtheme==""){
									window.location.hash='#/sales/prosale/backMoneyPlan'
								}
								else{
									window.location.hash='#/sales/prosale/backMoneyPlan?search='+this.inputtheme;
									search=this.inputtheme;
								}
							}else{
								statusid=this.value7.toString();
								if(this.inputtheme==""){
									window.location.hash=window.location.hash.split('&')[0];
								}
								else{
									window.location.hash=window.location.hash.split('&')[0]+'&search='+this.inputtheme;
									search=decodeURI(this.inputtheme);
								}
							}
							$.ajax({
							      type: "post",
							      url: "/sales/prosale/backMoneyPlan",
							      data: {pageNum:1,pageSize:pageSize,statusid:statusid,search:search},
							      success: function (sdata) {
							    	  console.log("页数打印*****："+sdata);
									  _this.bmptable=sdata.list;
									 _this.pages = sdata;
									 _this.currentPage4 = sdata.pageNum;
							      }
							});
						},
						
						
					}
				}
				var Ctor = Vue.extend(Main)
				new Ctor().$mount('#app1')
				
				/* 遮罩层 */
				var Main = {
					data() {
						return {
							formLabelWidth: '120px',
							comcustid: '',
							bmpform: {
								comcustid: '',
								orderid: '',
								date1: '',
								bmpmoney: '',
								radiosatus: '',
								uid: '',
								textcommunication: ''
							},
							dialogFormVisible: false,
							rules: {
								comcustid: [
									{required: true,message: '请选择客户',trigger: 'change'},
									],
									orderid: [
										{required: true,message: '请选择订单',trigger: 'change'},
										],
										bmpmoney: [
											{required: true,message: '总金额不能为空',trigger: 'blur'},
											],
											isBackMoney: [
												{required: true,message: '请选择回款状态',trigger: 'change'},
												],
												uid:[
												{required: true,message: '所有人不能为空',trigger: 'change'},
												],
								date1: [{
									required: true,
									message: '请选择计划回款日期',
									trigger: 'change'
								}],
							},
							customers:[],
							customer:[],
							cumloading:false,
							ordere:[],
							orderes:[],
							orloading:false,
							uitemv: [],
							uitemvs: [],
							uidloading: false,
						};
					},
					methods: {
				
						loadAll() {
							return [];
						},
						  addbmppage(){
								var _this=this;
								axios.post("/sales/prosale/addbmppage",
								//参数转换
								//Qs.stringify(this.form,{arrayFormat: 'brackets'})
								//ajax请求成功的回调函数
								).then(function(v){					          				
								console.log("回调成功，获取了服务器端返回的值v");
								console.log(v.data);
								//将数据装换成界面显示
							 	_this.customers= v.data.customer.map(item => {
									return { value: item.ID, label: item.name };
								}); 
								_this.customer=_this.customers;				  		
								/* _this.uosigns1= v.data.contact.map(item => {
									return { value: item.ID, label: item.name };
								}); */
								/* _this.contactes=v.data.contact; */
									_this.uitemvs= v.data.userAll.map(item => {
									 return { value: item.ID, label: item.name };
								});
								_this.uitemv=_this.uitemvs;
								console.log(_this.uitemvs);
									/* _this.optionspay=v.data.opay;
									_this.options=v.data.otype; */
									_this.dialogFormVisible = true;
									}).catch(function(){
								alert("信息出错了");
							 });							 
						},
						
						querySearchAsync(queryString, cb) {
							var restaurants = this.restaurants;
							var results = queryString ? restaurants.filter(this.createStateFilter(queryString)) : restaurants;
							clearTimeout(this.timeout);
							this.timeout = setTimeout(() => {
								cb(results);
							}, 3000 * Math.random());
						},
						 //加载界面客户
						orremoteMethod(query) {
							 var _this=this;
						      if (query !== '') {
						        this.orloading = true;
						        setTimeout(() => {
						          this.orloading = false;
						          this.ordere = _this.orderes.filter(item => {
						            return item.label.toLowerCase()
						              .indexOf(query.toLowerCase()) > -1;
						          });
						        }, 200);
						      } else {
						        this.orloading = true;
						       setTimeout(() => {
						         this.orloading = false;
						         this.ordere = _this.orderes.filter(item => {
									  return item.label;
						          /* return item.label.toLowerCase()
						             .indexOf(query.toLowerCase()) > -1; */
						         });
						       }, 200);
						      }
						    },
							comcustidto(){
							
								var _this=this;
								_this.customer=_this.customers;
							},
							uitemvto(){
								var _this=this;
								_this.uitemv=_this.uitemvs;
							},
							selectOne(){
								 var _this=this;
								axios.post("/sales/prosale/bmporderpage",
								Qs.stringify({
								'ID':_this.bmpform.comcustid
								}
								,{arrayFormat: 'brackets'})
								).then(function(v){					          				
								console.log("回调成功，获取了服务器端返回的值v");
								console.log(v.data);
								_this.bmpform.orderid=' ';
								_this.orderes= v.data.order.map(item => {
									return { value: item.ID, label: item.theme };
								}); 
								//_this.orderes
								}).catch(function(){
								alert("信息出错了");
								});					
							},
						 //加载界面客户
						cumremoteMethod(query) {
							var _this=this;
						      if (query !== '') {
						        this.cumloading = true;
						        setTimeout(() => {
						          this.cumloading = false;
						          this.customer = _this.customers.filter(item => {
						            return item.label.toLowerCase()
						              .indexOf(query.toLowerCase()) > -1;
						          });
						        }, 200);
						      } else {
						        this.uosign = [];
						      }
						    },
						
						    //加载界面所有者
						uidremoteMethod(query) {
							 var _this=this;
						      if (query !== '') {
						        this.uidloading = true;
						        setTimeout(() => {
						          this.uidloading = false;
						          this.uitemv = _this.uitemvs.filter(item => {
						            return item.label.toLowerCase()
						              .indexOf(query.toLowerCase()) > -1;
						          });
						        }, 200);
						      } else {
						        this.uosign = [];
						      }
						    },
						createStateFilter(queryString) {
							return (state) => {
								return (state.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0);
							};
						},
						handleSelect(item) {
							console.log(item);
						},
						mounted() {
							this.restaurants = this.loadAll();
						},
						submitForm(formName) {
							var _this=this;
							this.$refs[formName].validate((valid) => {
								if (valid) {
									//post提交数据
									axios.post("/sales/prosale/addbmp",
										//参数转换
										Qs.stringify(
										this.bmpform
										,{arrayFormat: 'brackets'})
										//	params:
										//ajax请求成功的回调函数
										).then(function(v){
										console.log("回调成功，获取了服务器端返回的值v");
										console.log(v);
										showAtRight('/sales/prosale/backMoneyPlan');
										_this.dialogFormVisible=false;
								}).catch(function(){
									alert("出错了");
								});
								} else {
									console.log('error submit!!');
									return false;
								}
							});
						},
						resetForm(formName) {
							this.$refs[formName].resetFields();
						}
					}
				}
				
				var Ctor = Vue.extend(Main)
				new Ctor().$mount('#app2')
				
				var app3=new Vue({
						el: "#app3",
						data: {
							formLabelWidth: '120px',
										comcustid: '',
										bmpform: {
											ID:'',
											comcustid: '',
											orderid: '',
											bmpbmpdate: '',
											bmpmoney: '',
											isBackMoney: '',
											uid: '',
											textcommunication: ''
										},
										rules: {
											comcustid: [
												{required: true,message: '请选择客户',trigger: 'change'},
												],
												orderid: [
													{required: true,message: '请选择订单',trigger: 'change'},
													],
													bmpmoney: [
														{required: true,message: '总金额不能为空',trigger: 'blur'},
														],
														radiosatus: [
															{required: true,message: '请选择回款状态',trigger: 'change'},
															],
															uid:[
															{required: true,message: '所有人不能为空',trigger: 'change'},
															],
											date1: [{
												required: true,
												message: '请选择计划回款日期',
												trigger: 'change'
											}],
										},
										customers:[],
										customer:[],
										cumloading:false,
										ordere:[],
										orderes:[],
										orloading:false,
										uitemv: [],
										uitemvs: [],
										uidloading: false,
								
								
								bmptable: backMoneytable,
								pages: pageinfo,
								currentPage4: pageinfo.pageNum,
								multipleSelection: [],
								dialogFormVisible: false,
								dialogDelete:false,
							
						},
						methods:{
							comcustidto(){
								var _this=this;
								_this.uitemv=_this.uitemvs;
							},
							uitemvto(){
								var _this=this;
								_this.uitemv=_this.uitemvs;
							},
							handleClick(row) {
								console.log(row);
							},
							updatehandleClick(row) {
								var _this = this;
								var id= row;
								console.log(row);
								alert(row);
								axios.post("/sales/prosale/updatebmppage",
									Qs.stringify( {
								   			'ID':id,
									   },{arrayFormat: 'brackets'}) 
									//ajax请求成功的回调函数
								).then(function(v) {
									console.log("回调成功，获取了服务器端返回的值v");
									console.log(v.data.bmpform);
									//加载修改页面客户
									_this.customers= v.data.customer.map(item => {
									return { value: item.ID, label: item.name };
									}); 
									_this.customer=_this.customers;
									//加载修改页面所有者				  		
									_this.uitemvs= v.data.userAll.map(item => {
									return { value: item.ID, label: item.name };
									}); 
									_this.uitemv=_this.uitemvs;
									 v.data.bmpform.map(bmpform => {
										 _this.bmpform.ID=id;
										_this.bmpform.comcustid=bmpform.custid;
										_this.bmpform.orderid=bmpform.orderid;
										_this.bmpform.bmpbmpdate=bmpform.bmpbmpdate;
										_this.bmpform.bmpmoney=bmpform.bmpmoney;
										_this.bmpform.isBackMoney=bmpform.isBackMoney;
										_this.bmpform.uid=bmpform.uid;
										_this.bmpform.textcommunication=bmpform.textcommunication;
									}); 
									//_this.selectOne();
								}) .catch(function() {
									alert("出错了");
								} ); 
								this.dialogFormVisible = true;
							},
							
							 addbmppage(){
									var _this=this;
									axios.post("/sales/prosale/addbmppage",
									//参数转换
									//Qs.stringify(this.form,{arrayFormat: 'brackets'})
									//ajax请求成功的回调函数
									).then(function(v){					          				
									console.log("回调成功，获取了服务器端返回的值v");
									console.log(v.data);
									//将数据装换成界面显示
								 	_this.customers= v.data.customer.map(item => {
										return { value: item.ID, label: item.name };
									}); 
													  		
									/* _this.uosigns1= v.data.contact.map(item => {
										return { value: item.ID, label: item.name };
									}); */
									/* _this.contactes=v.data.contact; */
										_this.uitemvs= v.data.userAll.map(item => {
										 return { value: item.ID, label: item.name };
									});
									
									console.log(_this.uitemvs);
										/* _this.optionspay=v.data.opay;
										_this.options=v.data.otype; */
										_this.dialogFormVisible = true;
										}).catch(function(){
									alert("信息出错了");
								 });							 
							},
							querySearchAsync(queryString, cb) {
								var restaurants = this.restaurants;
								var results = queryString ? restaurants.filter(this.createStateFilter(queryString)) : restaurants;
								clearTimeout(this.timeout);
								this.timeout = setTimeout(() => {
									cb(results);
								}, 3000 * Math.random());
							},
							 //加载界面客户
							orremoteMethod(query) {
								 var _this=this;
							      if (query !== '') {
							        this.orloading = true;
							        setTimeout(() => {
							          this.orloading = false;
							          this.ordere = _this.orderes.filter(item => {
							            return item.label.toLowerCase()
							              .indexOf(query.toLowerCase()) > -1;
							          });
							        }, 200);
							      } else {
							        this.orloading = true;
							       setTimeout(() => {
							         this.orloading = false;
							         this.ordere = _this.orderes.filter(item => {
										  return item.label;
							          /* return item.label.toLowerCase()
							             .indexOf(query.toLowerCase()) > -1; */
							         });
							       }, 200);
							      }
							    },
								selectOne(){
									 var _this=this;
									axios.post("/sales/prosale/bmporderpage",
									Qs.stringify({
									'ID':_this.bmpform.comcustid
									}
									,{arrayFormat: 'brackets'})
									).then(function(v){					          				
									console.log("回调成功，获取了服务器端返回的值v");
									console.log(v.data);
									_this.orderes= v.data.order.map(item => {
										return { value: item.ID, label: item.theme };
									}); 
									//_this.orderes
									}).catch(function(){
									alert("信息出错了");
									});					
								},
							 //加载界面客户
							cumremoteMethod(query) {
								var _this=this;
							      if (query !== '') {
							        this.cumloading = true;
							        setTimeout(() => {
							          this.cumloading = false;
							          this.customer = _this.customers.filter(item => {
							            return item.label.toLowerCase()
							              .indexOf(query.toLowerCase()) > -1;
							          });
							        }, 200);
							      } else {
							        this.uosign = [];
							      }
							    },
							
							    //加载界面所有者
							uidremoteMethod(query) {
								 var _this=this;
							      if (query !== '') {
							        this.uidloading = true;
							        setTimeout(() => {
							          this.uidloading = false;
							          this.uitemv = _this.uitemvs.filter(item => {
							            return item.label.toLowerCase()
							              .indexOf(query.toLowerCase()) > -1;
							          });
							        }, 200);
							      } else {
							        this.uosign = [];
							      }
							    },
							handleSelectionChange(val) {
								this.multipleSelection = val;
							},
							handleSizeChange(val) {
								Max.pasSize=val;
								var statusid=null;
								var search=null;
								var _this=this;
								//判断是否带条件;
								var url= window.location.href;
								var url1= url.indexOf("?");
								if(url1!=-1){
									//截取每一个条件
									var urlcondition= url.substring(url1+1,url.length).split('&');
									for(var i=0;i<urlcondition.length;i++){
										
										if(urlcondition[i].split('=')[0]=="statusid"){
											statusid=decodeURI(urlcondition[i].split('=')[1]);
										}
										if(urlcondition[i].split('=')[0]=="search"){
											search=decodeURI(urlcondition[i].split('=')[1]);
										}
									}
								}
								$.ajax({
								      type: "post",
								      url: "/sales/prosale/backMoneyPlan",
								      data: {pageNum:1,pageSize:val,statusid:statusid,search:search},
								      success: function (sdata) {
								    	  console.log("页数打印*****："+sdata);
								    	  _this.bmptable=sdata.list;
								          _this.pages=sdata;
										  _this.currentPage4=sdata.pageNum;
								      }
								});
											
							},
							handleCurrentChange(val) {
								//查询的行数
								var pageSize= Max.pasSize;
								var statusid=null;
								var search=null;
								var _this=this;
								//判断是否带条件;
								var url= window.location.href;
								var url1= url.indexOf("?");
								if(url1!=-1){
									//this.complaintheme=decodeURI(url.substring(url1+1,url.length).split('&')[0].split('=')[1]);
									//截取每一个条件
									var urlcondition= url.substring(url1+1,url.length).split('&');
									for(var i=0;i<urlcondition.length;i++){
										
										if(urlcondition[i].split('=')[0]=="statusid"){
											statusid=decodeURI(urlcondition[i].split('=')[1]);
										}
										if(urlcondition[i].split('=')[0]=="search"){
											search=decodeURI(urlcondition[i].split('=')[1]);
										}
									}
								}
								$.ajax({
								      type: "post",
								      url: "/sales/prosale/backMoneyPlan",
								      data: {pageNum:val,pageSize:pageSize,statusid:statusid,search:search},
								      success: function (sdata) {
								    	  console.log("页数打印*****："+sdata);
								    	  _this.bmptable=sdata.list;
								          _this.pages=sdata;
										  _this.currentPage4=sdata.pageNum;
								      }
								});
							},
											
							loadAll() {
								return [];
							},
							querySearchAsync(queryString, cb) {
								var restaurants = this.restaurants;
								var results = queryString ? restaurants.filter(this.createStateFilter(queryString)) : restaurants;
											
								clearTimeout(this.timeout);
								this.timeout = setTimeout(() => {
									cb(results);
								}, 3000 * Math.random());
							},
							createStateFilter(queryString) {
								return (state) => {
									return (state.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0);
								};
							},
							handleSelect(item) {
								console.log(item);
							},
							mounted() {
								this.restaurants = this.loadAll();
							},
												
							submitForm(formName) {
								var _this=this;
								//验证方法
								this.$refs[formName].validate((valid) => {
									if (valid) {
										//post提交数据
										axios.post("/sales/prosale/updatebmp",
											//参数转换
											Qs.stringify(this.bmpform, {
												arrayFormat: 'brackets'
											})
											//id:
											//ajax请求成功的回调函数
										).then(function(v) {
											console.log("回调成功，获取了服务器端返回的值v");
											console.log(v);
											showAtRight('/sales/prosale/backMoneyPlan');
											_this.dialogFormVisible=false;
										}).catch(function() {
											alert("出错了");
										});
									} else {
										console.log('error submit!!');
										return false;
									}
								});
							},
							resetForm(formName) {
								this.$refs[formName].resetFields();
							},
							deletenew(ID){
								this.ID=ID;
								this.dialogDelete=true;
								
							},
							//删除方法
							Delete(){
								var _this=this;
								axios.post("/sales/prosale/deletebmp",
							   			//参数转换
							   			Qs.stringify({
											'ID':_this.ID
										},{arrayFormat: 'brackets'})
							   			//ajax请求成功的回调函数
							  			).then(function(response){					          				
							   			console.log("回调成功，获取了服务器端返回的值v");
							   			console.log(response.data);					           		
							   		_this.restaurants=response.data;
							   		/* this.$message({
										type: 'success',
										message: '删除成功!'
									}); */
							   		alert("删除成功！");
							   		showAtRight('/sales/prosale/backMoneyPlan');
											
							   	}).catch(function(){
							   		alert("删除失败！");
							   		/*this.$message({
										type: 'error',
										message: '删除失败!'
									});*/
							   	});	//这个是数据的初始化
							  }
						},
					})
			</script>
		</body>

</html>